package com.three.Service.ServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.three.Mapper.DormMapper;
import com.three.Pojo.Dorm;
import com.three.Service.IDormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DormServiceImpl implements IDormService {
    @Autowired
    private DormMapper dormMapper;

    @Override
    public void addsave(Dorm dorm) {
        dormMapper.addsave(dorm);
    }

    @Override
    public PageInfo<Dorm> findlist(Integer pageNum, Integer pageSize, String dormName) {
        PageHelper.startPage(pageNum,pageSize);
        List<Dorm> dormList=dormMapper.finddormlist(dormName);
        PageInfo<Dorm> pageInfo=new PageInfo<>(dormList);
        return pageInfo;
    }

    @Override
    public Dorm findByid(Integer id) {
        return dormMapper.findByid(id);
    }

    @Override
    public void delte(Integer id) {
        dormMapper.delte(id);
    }

    @Override
    public void updatesave(Dorm dorm) {
        dormMapper.updatesave(dorm);

    }
}
